package com.beifu.manager.service.assettype.impl;

import com.beifu.manager.dao.AssetTypeMapper;
import com.beifu.manager.model.AssetType;
import com.beifu.manager.model.AssetTypeExample;
import com.beifu.manager.service.assettype.AssetTypeService;
import com.mds.manager.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 再壮 on 2018/6/19.
 */
@Service
public class AssetTypeServiceImpl implements AssetTypeService {

    @Autowired
    private AssetTypeMapper assetTypeMapper;

    @Override
    public PageUtils getDataPages(PageUtils Page) {
        AssetTypeExample example = (AssetTypeExample) Page.getQueryParames();
        List<AssetType> list = assetTypeMapper.getDataPages((Page.getPage()-1)*Page.getLimit(),Page.getLimit(), example);
        int count = assetTypeMapper.countByExample(example);
        Page.setList(list);
        Page.setCountNum(count);
        return Page;
    }

    @Override
    public int insert(AssetType record) {
        return assetTypeMapper.insert(record);
    }

    @Override
    public int updateByPrimaryKey(AssetType record) {
        return assetTypeMapper.updateByPrimaryKey(record);
    }

    @Override
    public int batchDel(String[] ids) {
        return assetTypeMapper.batchDel(ids);
    }
}
